<template>
  <div class="ele-body">
    <el-card shadow="never">
      <!-- 搜索表单 -->
      <role-search @search="reload" />
      <!-- 数据表格 -->

      <ele-pro-table ref="table"
                     :columns="columns"
                     :datasource="datasource"
                     :selection.sync="selection"
                     descendValue="desc"
                     tool-class="ele-toolbar-form"
                     row-key="id">
        <!-- 表头工具栏 -->
        <template v-slot:toolbar>
          <el-button size="small"
                     type="primary"
                     icon="el-icon-plus"
                     class="ele-btn-icon"
                     @click="onExport(list)">
            导出
          </el-button>

        </template>

        <template v-slot:img="{ row }">
          <div><img class="categoryImages"
                 :src="row.img"
                 alt="" /></div>
        </template>
        <template v-slot:content="{ row }">
          <div v-html="row.content"></div>
        </template>

        <!-- 状态列 -->
        <template v-slot:sex="{ row }">
          {{ row.sex == 0 ? '性别不限' : row.sex == 1 ? '男' : '女' }}
        </template>
        <template v-slot:nickname="{ row }">
          <div v-if="row.nickname">
            <div class="realNameStyle">
              <img class="avaterName"
                   :src="row?.avatar"
                   alt="" />
              <span>{{ row.nickname }}</span>
            </div>
          </div>
          <div v-else>-----</div>
        </template>

        <template v-slot:pName="{ row }">
          {{row.pName?row.pName:'-----'}}
        </template>
        <template v-slot:aName="{ row }">
          {{row.aName?row.aName:'-----'}}
        </template>
        <template v-slot:is_authentication="{ row }">
          {{ orderStatusFn(row.is_authentication) }}
        </template>
        <template v-slot:level_id="{ row }">
          {{ row.level_id==1?'不是vip会员':'当前vip会员' }}
        </template>

        <template v-slot:state="{ row }">
          {{ fxyStateFn(row.state) }}
        </template>
        <template v-slot:superiorUser="{ row }">
          <div v-if="row.p_nickname">
            <div class="realNameStyle">
              <img class="avaterName"
                   :src="row.p_avatar"
                   alt="" />
              <span>{{ row.p_nickname }}</span>
            </div>
          </div>
          <div v-else>-----</div>
        </template>
        <template v-slot:distributionGrCode="{ row }">
          <el-link type="primary"
                   :underline="false"
                   icon="el-icon-view"
                   @click="openInvoices(row.invite_url)">
            查看
          </el-link>
        </template>
        <template v-slot:invite_xcx_url="{ row }">
          <el-link type="primary"
                   :underline="false"
                   icon="el-icon-view"
                   @click="openInvoice(row)">
            查看
          </el-link>
        </template>
        <!-- 操作列 -->
        <template v-slot:action="{ row }">
          <el-link type="primary"
                   :underline="false"
                   icon="el-icon-edit"
                   @click="deductionTA(row)">
            余额操作
          </el-link>
          <el-link v-if="row.is_authentication != 0"
                   type="primary"
                   :underline="false"
                   @click="openEdit(row)">
            详情
          </el-link>
          <el-link type="primary"
                   :underline="false"
                   @click="balanceRecords(row)">
            用户明细
          </el-link>
          <!-- <el-link v-if="row.state"
                   type="primary"
                   :underline="false"
                   @click="distributionAuditStatus(row)">
            分销审核状态
          </el-link> -->
          <el-link v-if="row.order_status == 3 || row.order_status == 4"
                   type="primary"
                   :underline="false"
                   @click="snapshot(row)">
            订单完成描述
          </el-link>
          <el-link :type="row.disable==0?'primary':'danger'"
                   :underline="false"
                   @click="blockFn(row)">
            {{row.disable==0?'解禁':'禁用' }}
          </el-link>
        </template>
      </ele-pro-table>
    </el-card>

    <Camilist :data="current1"
              :drawerEditBoolen.sync="drawerEditBoolen1"
              @done="reload" />
    <!-- 编辑弹窗 -->
    <role-edit :data="current"
               :drawerEditBoolen.sync="drawerEditBoolen"
               @done="reload" />

    <el-dialog title="拒绝原因"
               :visible.sync="centerDialogVisible"
               width="30%"
               center>
      <el-input type="textarea"
                :rows="2"
                resize="none"
                placeholder="请输入拒绝原因"
                v-model="textarea">
      </el-input>
      <span slot="footer"
            class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary"
                   @click="refuseOrderSureFn()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="推广海报码"
               style="text-align: center"
               :visible.sync="dialogVisibles"
               width="25%">
      <img class="imgCode"
           :src="qRCode"
           alt="" />
      <span slot="footer"
            class="dialog-footer">
        <el-button type="primary"
                   @click="dialogVisibles = false">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="订单快照"
               :visible.sync="snapshotDialogVisible"
               width="50%"
               center>
      <div style="text-align: center">
        <el-input type="textarea"
                  :disabled="true"
                  resize="none"
                  v-model="snapshotDataRemark">
        </el-input>
        <img @click="handlePictureCardPreview(snapshotData?.complete_img)"
             style="
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            margin-top: 20px;
          "
             :src="snapshotData?.complete_img"
             alt="" />
      </div>
      <span slot="footer"
            class="dialog-footer">
        <el-button @click="snapshotDialogVisible = false">取 消</el-button>
        <el-button type="primary"
                   @click="snapshotDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 导入弹窗 -->
    <ele-modal width="600px"
               height="300px"
               :title="'扣除/添加（'+configBS?.currency_name+'）'"
               :visible.sync="visibleModalDelivery"
               :maxable="true">
      <!-- class="SigningReminder" -->
      <el-form ref="form"
               :model="form"
               label-width="100px">
        <el-form-item label="选择类型:"
                      prop="type">
          <el-radio-group v-model="form.type"
                          @input="switchFn">
            <el-radio :label="1">添加</el-radio>
            <el-radio :label="2">扣除</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item :label="'扣除/添加的'+configBS?.currency_name+':'"
                      prop="balance">
          <el-input class="uni-input"
                    v-model="form.balance"
                    :placeholder="'请输入要扣除/添加的'+configBS?.currency_name"></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer"
            class="dialog-footer">
        <el-button @click="visibleModalDelivery = false">取 消</el-button>
        <el-button type="primary"
                   :loading="loading"
                   @click="visibleModalDeliverFn()">确定</el-button>
      </span>
    </ele-modal>
    <!-- 分销员 -->
    <ele-modal width="600px"
               height="300px"
               title="分销员审核状态"
               :visible.sync="auditStatusVisible"
               :maxable="true">
      <!-- class="SigningReminder" -->
      <div style="margin-bottom: 10px;">分销员申请姓名:{{ distributionData.real_name }}</div>
      <div style="margin-bottom: 10px;">分销员申请电话:{{ distributionData.phone }}</div>
      <div style="margin-bottom: 10px;">分销员申请地址:{{ distributionData.distribution_addr }}</div>
      <el-radio-group v-model="distributionStatus"
                      @input="inputChange">

        <el-radio :label="2"
                  v-if="distributionData.state == 1">审核通过</el-radio>

        <el-radio :label="3"
                  v-if="distributionData.state == 1||distributionData.state == 3">驳回</el-radio>
      </el-radio-group>
      <div style="margin-top: 15px;">
        <el-input v-if="showTextarea"
                  :disabled="distributionData.state == 3 ? true : false"
                  type="textarea"
                  resize="none"
                  placeholder="请输入内容"
                  v-model="rationale">
        </el-input>
      </div>
      <span slot="footer"
            class="dialog-footer">
        <el-button @click="auditStatusVisible = false">取 消</el-button>
        <el-button type="primary"
                   :loading="loading"
                   @click="auditStatusVisibleFn(distributionData,distributionStatus)">确定</el-button>
      </span>
    </ele-modal>

    <balanceEdit :data="currentss"
                 :drawerEditBoolens.sync="drawerEditBoolens" />
    <!-- <contactEdit :data="currentContact"
                 :drawerEditBoolens.sync="drawerContactBoolen"></contactEdit> -->
    <el-image-viewer v-if="viewerVisible"
                     style="z-index: 9999"
                     :on-close="closeViewer"
                     :url-list="imgViewArr" />
    <!-- 权限分配弹窗 -->
  </div>
</template>
<script>
import { utils, writeFile } from 'xlsx';
import ElImageViewer from 'element-ui/packages/image/src/image-viewer';
import balanceEdit from './components/balance-edit';
import contactEdit from './components/contact-edit '
import RoleSearch from './components/role-search';
// import Sortable from 'sortablejs';
import RoleEdit from './components/role-edit';
import { carouselList } from './constant/constant';
import Camilist from './components/Camilist';
import {
  refuseServiceOrder,
  settlementService
} from '@/api/serviceManagement/index';
import { userList, setAmount, getUserinvitexcxurl, editUserDisable, distributorEditState } from '@/api/userList/index';
// import {
//   sitecCategoriesDelete,
//   siteCategoriesList,
//   siteCategoriesModify,
//   siteCategoriesDetail,
//   siteBatchCategoriesDelete
// } from '@/api/serviceManagement/categoriesList';
export default {
  name: 'Recharge',
  components: {
    RoleSearch,
    RoleEdit,
    Camilist,
    ElImageViewer,
    balanceEdit,

  },
  data () {
    const defaultWhere = {
      id: '',
      type: 1,
      balance: ''
    };
    return {
      form: { ...defaultWhere },
      configBS: JSON.parse(localStorage.getItem('config')),
      currentss: '',
      drawerEditBoolens: false,
      carouselList,
      centerDialogVisible: false,
      snapshotDialogVisible: false,
      dialogVisibles: false,
      drawerContactBoolen: false,
      currentContact: '',
      // 表格列配置
      columns: [
        {
          columnKey: 'index',
          type: 'index',
          width: 45,
          align: 'center',
          showOverflowTooltip: true,
          fixed: 'left'
        },
        {
          prop: 'nickname',
          label: '昵称',
          align: 'center',
          showOverflowTooltip: false,
          minWidth: 110,
          slot: 'nickname'
        },
        {
          prop: 'phone',
          label: '手机号',
          align: 'center',
          minWidth: 110
        },

        {
          prop: 'level_name',
          label: '会员等级',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 110
        },
        {
          prop: 'balance',
          label: '余额',
          align: 'center',
          sortable: 'custom',
          showOverflowTooltip: true,
          minWidth: 110
        },
        {
          prop: 'total_income',
          label: '总收益',
          sortable: 'custom',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 110
        },
        {
          prop: 'community_income',
          label: '社群收益',
          showOverflowTooltip: true,
          minWidth: 110,
          align: 'center'
        },
        {
          prop: 'dazi_income',
          label: '搭子收益',
          showOverflowTooltip: true,
          minWidth: 110,
          align: 'center'
        },
        {
          prop: 'service_income',
          label: '服务收益',
          showOverflowTooltip: true,
          minWidth: 110,
          align: 'center'
        },

        {
          prop: 'pName',
          label: '直属上级(推广员)',
          align: 'center',
          showOverflowTooltip: false,
          minWidth: 110,
          slot: 'pName',
        },
        {
          prop: 'aName',
          label: '直属上级(合伙人)',
          align: 'center',
          showOverflowTooltip: false,
          minWidth: 110,
          slot: 'aName',
        },
        {
          prop: 'distributionGrCode',
          label: '推广海报(公众号)',
          sortable: 'custom',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 210,
          slot: 'distributionGrCode'
        },
        {
          prop: 'invite_xcx_url',
          label: '推广海报（小程序）',
          sortable: 'custom',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 210,
          slot: 'invite_xcx_url'
        },
        {
          prop: 'is_authentication',
          label: '认证状态',
          showOverflowTooltip: true,
          minWidth: 110,
          align: 'center',
          slot: 'is_authentication'
        },
        {
          prop: 'state',
          label: '推广员状态',
          sortable: 'custom',
          align: 'center',
          showOverflowTooltip: true,
          minWidth: 210,
          slot: 'state'
        },
        // {
        //   prop: 'level_id',
        //   label: '是否为会员',
        //   sortable: 'custom',
        //   align: 'center',
        //   showOverflowTooltip: true,
        //   minWidth: 210,
        //   slot: 'level_id'
        // },

        {
          prop: 'create_time',
          label: '创建时间',
          align: 'center',
          sortable: 'custom',
          showOverflowTooltip: false,
          minWidth: 110,
          formatter: (_row, _column, cellValue) => {
            return this.$util.toDateString(cellValue);
          }
        },

        {
          columnKey: 'action',
          label: '操作',
          minWidth: 350,
          align: 'center',
          resizable: false,
          slot: 'action',
          showOverflowTooltip: false,
          fixed: 'right'
        }
      ],
      textarea: '',
      auditStatusVisible: false,
      // 表格选中数据
      selection: [],
      // 当前编辑数据
      current: null,
      current1: null,
      drawerEditBoolen: false,
      // 是否显示编辑弹窗
      drawerEditBoolen1: false,
      // 是否显示导入弹窗
      showAuth: false,
      showChoose: false,
      dialogVisible: false,
      levelId: null,
      refuseOrderId: null,
      snapshotData: null,
      snapshotDataRemark: null,
      viewerVisible: false,
      imgViewArr: null,
      visibleModalDelivery: false,
      loading: false,
      list: [],
      qRCode: '',
      distributionData: {},
      distributionStatus: 2,
      rationale: '',
      showTextarea: false
    };
  },
  mounted () { },
  activated () {
    this.reload();
  },
  computed: {
    orderStatusFn: function () {
      return function (status) {
        let orderStatus = '';
        // 1 待接单 2 接单中 3 完成 4 已结算 4拒绝订单
        orderStatus =
          status == 0
            ? '未提交'
            : status == 1
              ? '待审核'
              : status == 2
                ? '审核通过'
                : '驳回';

        return orderStatus;
      };
    },
    fxyStateFn: function () {
      return function (status) {
        let orderStatus = '';
        // 1 待接单 2 接单中 3 完成 4 已结算 4拒绝订单
        orderStatus =
          status == null
            ? '未提交'
            : status == 1
              ? '待审核'
              : status == 2
                ? '审核通过'
                : '驳回';

        return orderStatus;
      };
    },
  },

  methods: {

    distributionAuditStatus (row) {
      console.log(this.distributionStatus)
      this.auditStatusVisible = true
      this.distributionData = row
      this.distributionStatus = row.state == 1 ? 2 : 2
      if (this.distributionStatus == 3) {
        this.showTextarea = true;
        console.log(row.rationale)
        this.rationale = row.rationale
      } else {
        this.showTextarea = false;
      }
    },
    async auditStatusVisibleFn (row, distributionStatus) {
      this.showTextarea = false;

      if (row.state == 2 || row.state == 3) {
        this.auditStatusVisible = false
        this.rationale = null;
      } else {
        const res = await distributorEditState({
          id: row.distributor_id,
          state: distributionStatus,
          rationale: this.rationale
        })
        console.log(res)
        if (res.code == 0) {
          this.auditStatusVisible = false
          this.reload();
          this.$message.success(res.message);
          this.rationale = null;

        } else {
          this.$message.error(res.message);
        }
      }

    },
    inputChange (e) {



      if (e == 3) {
        this.showTextarea = true;

        this.distributionStatus = e;

      } else {
        this.rationale = null;
        this.showTextarea = false;
        console.log(e)
        this.distributionStatus = e
      }
    },
    blockFn (row) {
      const loading = this.$loading({ lock: true });
      editUserDisable({
        id: row.id,
        disable: row.disable == 0 ? 1 : 0,

      })
        .then((msg) => {
          console.log(msg)
          loading.close();
          this.$message.success(msg.message);
          this.reload();
        })
        .catch((e) => {
          loading.close();
          row.disable == 0 ? 1 : 0,
            this.$message.error(e.message);
        });

    },
    onExport (row) {
      row.then(res => {
        console.log(res.list)

        const array = [
          ['序号', '昵称', '手机号', '余额', '总收益', '搭子收益', '服务收益', '用户上级', '认证状态', '公众号分销码', '创建时间']
        ];
        res.list.forEach((d, i) => {
          array.push([i + 1, d.nickname, d.phone, d.balance, d.total_income, d.dazi_income, d.service_income, d.p_nickname, this.orderStatusFn(d.is_authentication), d.invite_url, d.create_time]);
        });
        const sheet = utils.aoa_to_sheet(array);
        // 如果需要设置列宽可以这样写
        sheet["!cols"] = [
          { wch: 10 },
          { wch: 40 },
          { wch: 30 },
          { wch: 30 },
          { wch: 30 },
          { wch: 30 },
          { wch: 40 },
          { wch: 30 },
          { wch: 40 },
          { wch: 30 },
          { wch: 30 },


        ];
        writeFile(
          {
            SheetNames: ['Sheet1'],
            Sheets: {
              Sheet1: sheet
            }
          },
          '用户数据.xlsx'
        );
      })

    },
    switchFn (e) {
      console.log(e);
      this.form.type = e;
    },
    deductionTA (row) {
      // this.$util.assignObject(this.form, {
      //   ...row
      // });

      this.form.id = row.id;
      console.log(this.form);

      this.visibleModalDelivery = true;
    },
    balanceRecords (row) {
      if (row?.id) {
        // const res = await siteCategoriesDetail(row.id);

        this.currentss = row;
        // 用户余额管理
        this.drawerEditBoolens = !this.drawerEditBoolens;
      } else {
        this.drawerEditBoolens = !this.drawerEditBoolens;
        this.currentss = null;
      }
    },
    applyMyphoneNumber (row) {
      if (row?.id) {
        // const res = await siteCategoriesDetail(row.id);

        this.currentContact = row;
        // 用户余额管理
        this.drawerContactBoolen = !this.drawerContactBoolen;
      } else {
        this.drawerContactBoolen = !this.drawerContactBoolen;
        this.currentContact = null;
      }
    },
    //    查看海报
    async openInvoice (row) {
      // 点击按钮预览图片

      const res = await getUserinvitexcxurl({
        id: row.id

      })
      console.log(res)

      console.log(row.invite_xcx_url);

      if (res.data.data) {
        this.qRCode = res.data.data;
        this.dialogVisibles = true;
      } else {
        this.$message.warning('当前没有登录小程序无法生成核销码');
      }
    },
    async openInvoices (imgGzh) {
      // 点击按钮预览图片


      console.log(imgGzh);

      this.qRCode = imgGzh;
      this.dialogVisibles = true;
    },
    async visibleModalDeliverFn () {
      if (this.form.balance && this.form.type) {
        this.loading = true;
        const res = await setAmount({
          balance: this.form.balance,

          id: this.form.id,
          type: this.form.type
        });
        console.log(res.data);
        if (res.code == 0) {
          this.$message.success(res.message);
          this.loading = false;

          (this.visibleModalDelivery = false), this.reload();

          this.form = { ...this.defaultWhere };
        } else {
          this.loading = false;
          this.$message.error(res.message);
        }
      } else {
        this.$message.error('请填写需要添加/移除的' + JSON.parse(localStorage.getItem('config')).currency_name);
      }
    },
    confirmReceipt (row) {
      settlementService({
        id: row.order_id
      })
        .then((msg) => {
          console.log(msg);

          this.$message.success(msg.message);
          this.reload();
        })
        .catch((e) => {
          this.$message.error(e.message);
        });
    },
    handlePictureCardPreview (imgStr) {
      console.log(imgStr);
      if (imgStr.length) {
        if (imgStr.includes(',')) {
          console.log('字符串中包含逗号');
          // 包含的进行slice(',') 分割

          this.imgViewArr = imgStr.split(',').map((item) => item.trim());
        } else {
          console.log('字符串中不包含逗号');
          this.imgViewArr = imgStr.split();
        }

        this.viewerVisible = true;
      } else {
        this.$message({
          message: '没有上传图片无法进行预览',
          type: 'warning'
        });
      }
    },
    // 关闭查看器
    closeViewer () {
      this.viewerVisible = false;
    },
    snapshot (row) {
      this.snapshotData = row;
      this.snapshotDataRemark = row.remark;
      this.snapshotDialogVisible = !this.snapshotDialogVisible;
    },
    refuseOrderSureFn () {
      if (this.textarea) {
        const loading = this.$loading({ lock: true });
        refuseServiceOrder({
          id: this.refuseOrderId,
          remark: this.textarea
        })
          .then((msg) => {
            console.log(msg);
            loading.close();
            this.$message.success(msg.message);
            this.reload();
          })
          .catch((e) => {
            loading.close();

            this.$message.error(e.message);
          });
      } else {
        this.$message.error('请填写拒绝原因');
      }
    },

    // rowDrop () {
    //   const tbody = document.querySelector('.el-table__body-wrapper tbody');
    //   const _this = this;
    //   Sortable.create(tbody, {
    //     forceFallback: true,
    //     dragClass: 'drag',
    //     delay: 100,
    //     animation: 1000,
    //     onEnd ({ newIndex, oldIndex }) {
    //       console.log(newIndex);
    //       console.log(oldIndex);
    //       //更换表格数据 后续拖动坐标才会正确
    //       let data = _this.$refs.table.getData();

    //       let nid = data[newIndex].id;
    //       let oid = data[oldIndex].id;

    //       const currRow = data.splice(oldIndex, 1)[0];
    //       data.splice(newIndex, 0, currRow);

    //       console.log(data);

    //       //   sortChange(data)
    //       //     .then((msg) => {

    //       //     })
    //       //     .catch((e) => {
    //       //       _this.$refs.table.reload();
    //       //     });

    //       //去数据库更换排序

    //       console.log(_this.$refs.table.getData());
    //     }
    //   });
    // },
    async openCami (row) {
      console.log(row);
      if (row?.id) {
        // const res = await siteCategoriesDetail(row.id);

        this.current1 = row;
        // 用户余额管理
        this.drawerEditBoolen1 = !this.drawerEditBoolen1;
      } else {
        this.drawerEditBoolen1 = !this.drawerEditBoolen1;
        this.current1 = null;
      }
    },
    /* 表格数据源 */
    datasource ({ page, limit, where }) {
      this.list = userList({
        page,
        limit,
        ...where
      });

      return this.list
    },
    /* 刷新表格 */
    reload (where) {
      this.$refs.table.reload({ page: 1, where: where });
    },
    /* 显示编辑 */
    async openEdit (row) {
      console.log(row);
      if (row?.id) {
        // const res = await siteCategoriesDetail(row.id);

        this.current = row;
        // 用户余额管理
        this.drawerEditBoolen = !this.drawerEditBoolen;
      } else {
        this.drawerEditBoolen = !this.drawerEditBoolen;
        this.current = null;
      }
    },
    refuseOrder (row) {
      this.refuseOrderId = row.order_id;
      this.centerDialogVisible = !this.centerDialogVisible;
    },

    // /* 更改状态 */
    // editStatus (row) {
    //   const loading = this.$loading({ lock: true });
    //   upClassify({
    //     id: row.id,
    //     status: row.status,

    //   })
    //     .then((msg) => {
    //       console.log(msg)
    //       loading.close();
    //       this.$message.success(msg.message);
    //       this.reload();
    //     })
    //     .catch((e) => {
    //       loading.close();
    //       row.status = !row.status ? 1 : 2;
    //       this.$message.error(e.message);
    //     });
    // },

    /* 显示分配权限 */
    openAuth (row) {
      this.current = row;
      this.showAuth = true;
    }
    /* 删除 */
    // remove (row) {
    //   const loading = this.$loading({ lock: true });
    //   upClassify({
    //     id: row.id,
    //     status: 0,

    //   })
    //     .then((msg) => {
    //       loading.close();
    //       this.$message.success(msg);
    //       this.reload();
    //     })
    //     .catch((e) => {
    //       loading.close();
    //       this.$message.error(e.message);
    //     });
    // },
    /* 批量删除 */
    // removeBatch () {
    //   if (!this.selection.length) {
    //     this.$message.error('请至少选择一条数据');
    //     return;
    //   }
    //   console.log(this.selection);
    //   this.$confirm('确定要删除选中的信息吗?', '提示', {
    //     type: 'warning'
    //   })
    //     .then(() => {
    //       const loading = this.$loading({ lock: true });
    //       console.log(this.selection.map((d) => d.id));
    //       siteBatchCategoriesDelete(this.selection.map((d) => d.id))
    //         .then((msg) => {
    //           loading.close();
    //           this.$message.success(msg);
    //           this.reload();
    //         })
    //         .catch((e) => {
    //           loading.close();
    //           this.$message.error(e.message);
    //         });
    //     })
    //     .catch(() => { });
    // }
  }
};
</script>

  <style lang="less" scoped>
.categoryImages {
  width: 50px;
  height: 50px;
}
.imgCode {
  width: 100%;
  height: 300px;
}
.realNameStyle {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .avaterName {
    width: 32px;
    height: 32px;
    border-radius: 32px;
    vertical-align: middle;
    margin-right: 5px;
  }
}
</style>
